package com.itheima.web;

import com.itheima.dto.CheckGroupDto;
import com.itheima.pojo.CheckGroup;
import com.itheima.service.CheckGroupService;
import com.itheima.support.PageResult;
import com.itheima.support.QueryPageBean;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/checkgroup")
public class CheckGroupController {

    @Reference//proxy
    private CheckGroupService checkGroupService;

    @PostMapping("/save")
    public boolean save(@RequestBody CheckGroupDto checkGroupDto){
        return checkGroupService.save(checkGroupDto);
    }

    @GetMapping("/deleteById/{id}")
    public boolean deleteById(@PathVariable("id") Long id){
        return checkGroupService.deleteById(id);
    }

    @GetMapping("/findAll")
    public List<CheckGroup> findAll(){
        return checkGroupService.findAll();
    }

    @PostMapping("/findByPage")
    public PageResult findByPage(@RequestBody QueryPageBean queryPageBean){
        return checkGroupService.findByPage(queryPageBean);
    }

}
